﻿using System;
using System.Collections;
using System.Linq;
using System.Linq.Expressions;

namespace WooCoo.DataPortal.Client
{
    /// <summary>non-generic placeholder for generic implementation</summary>
    public abstract class DataPortalQuery : IQueryable, IEnumerable
    {
        public abstract Type ElementType
        {
            get;
        }
        /// <summary>Linq Expression</summary>
        public abstract Expression Expression
        {
            get;
        }
        public abstract IQueryProvider Provider
        {
            get;
        }
        internal DataPortalQuery()
        {
        }
        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new System.NotImplementedException();
        }
        public IEnumerable Execute()
        {
            return this.ExecuteInternal();
        }
        public IAsyncResult BeginExecute(AsyncCallback callback, object state)
        {
            return this.BeginExecuteInternal(callback, state);
        }
        public IEnumerable EndExecute(IAsyncResult asyncResult)
        {
            return this.EndExecuteInternal(asyncResult);
        }
        internal abstract IEnumerable ExecuteInternal();
        internal abstract IAsyncResult BeginExecuteInternal(AsyncCallback callback, object state);
        internal abstract IEnumerable EndExecuteInternal(IAsyncResult asyncResult);
    }
}
